<template>
  <el-form ref="form" :model="form" label-width="80px">
    <el-form-item label="公司Logo:">
      <picture-wall :urls="data.avator"></picture-wall>
    </el-form-item>
    <el-form-item label="公司简介:">
      <el-input type="textarea" v-model="data.info" autosize></el-input>
    </el-form-item>
    <el-form-item label="公司地址:">
      <el-input v-model="data.address"></el-input>
    </el-form-item>
    <el-form-item label="公司电话:">
      <el-input v-model="data.phone"></el-input>
    </el-form-item>
  </el-form>
</template>

<script lang="ts">
import { Vue, Component } from "vue-property-decorator";
import { getHomeData } from "@/apis/Home";
import { reqYczsInfoType } from "CustomTypes";
import PictureWall from "@/components/PictureWall.vue";
import request from "@/utils/request";
import { HeadModule } from "@/store/modules/HeadModule";
import { rNames } from "@/config/menuConfig";

@Component({
  name: "Home",
  components: { PictureWall }
})
export default class Home extends Vue {
  data: reqYczsInfoType = {};
  form: object = {
    name: "",
    region: "",
    date1: "",
    date2: "",
    delivery: false,
    type: [],
    resource: "",
    desc: ""
  };
  dialogVisible = false;

  async init() {
    try {
      const { data } = await getHomeData();
      this.data = data;
    } catch (error) {
      console.log(error);
    }
  }

  onSubmit() {
    console.log("submit!");
  }

  handleRemove(file: string, fileList: Array<string>) {
    console.log(file, fileList);
  }

  handlePictureCardPreview(file: { url: Array<string> }) {
    this.data.avator = file.url;
    this.dialogVisible = true;
  }

  mounted() {
    this.init();
  }
}
</script>

<style></style>
